import torch
device = 'cuda' if torch.cuda.is_available() else 'cpu'
class SACConfig:
    def __init__(self):
        self.algo_name = 'SAC'
        self.env_name = 'Pendulum-v1'
        self.seed = 50  # 随机种子
        self.train_eps = 400  # 训练迭代次数
        self.test_eps = 10  # 测试迭代次数
        self.eval_eps = 10  # 评估迭代次数
        self.max_steps = 200  # 每次迭代最大时间步
        self.gamma = 0.99  # 折扣因子
        self.mean_lambda = 1e-3  # 重参数化分布均值的损失权重
        self.std_lambda = 1e-3  # 重参数化分布标准差的损失权重
        self.z_lambda = 0.0  # 重参数化分布抽样值的损失权重
        self.soft_tau = 1e-2  # 目标网络软更新系数
        self.value_lr = 3e-4  # 值网络的学习率
        self.soft_q_lr = 3e-4  # Q网络的学习率
        self.policy_lr = 3e-4  # 策略网络的学习率
        self.capacity = 1000000  # 经验缓存池的大小
        self.hidden_dim = 256  # 隐藏层维度
        self.batch_size = 128  # 批次大小
        self.start_steps = 1000  # 利用前的探索步数
        self.buffer_size = 1000000  # 经验回放池大小
        self.device = torch.device(device)  # 使用设备
class SACdConfig:
    def __init__(self):
        self.actor_lr = 1e-3
        self.critic_lr = 1e-2
        self.alpha_lr = 1e-2
        self.num_episodes = 200
        self.hidden_dim = 128
        self.gamma = 0.98
        self.tau = 0.005  # 软更新参数
        self.buffer_size = 10000
        self.minimal_size = 500
        self.batch_size = 64
        self.target_entropy = -1
        self.device = torch.device("cuda") if torch.cuda.is_available() else torch.device(
            "cpu")
class PPOConfig:
    def __init__(self):
        self.gamma = 0.99
        self.device = 'cuda' if torch.cuda.is_available() else 'cpu'
        self.n_states = new_obs_dim
        self.n_actions = new_action_dim
        self.actor_hidden_dim = 256
        self.critic_hidden_dim = 256
        self.actor_lr = 0.0003
        self.critic_lr = 0.0003
        self.k_epochs = 4 # 更新策略网络的次数
        self.eps_clip =0.2
        self.update_freq = 999  #采样多少次后更新一次
        self.eval_eps = 5  # 评估的回合数
        self.eval_per_episode = 10  # 评估的频率
        self.entropy_coef = 0.1  # entropy的系数